var PlayMainLayer = cc.Layer.extend({
	flow:null,
	scene:null,
	desk:null,
	comp_close:null,
	comp_open:null,
	apparatus:null,
	treater:null,
	airpump:null,
	Pneumatic:null,
	runningAction:null,
	runningAction1:null,
	runningAction2:null,
	runningAction3:null,
	status:true,
	ctor:function(parent,tag){
		this._super();
		this.init();
		this.scene=parent;
		this.setTag(tag);
		this.flow=this.scene.flow;
		this.scene.addChild(this,10);
		this.loadEquitment();
	},
	loadEquitment:function(){
		this.g5_Comp=new G5_Comp(this,this.flow,TAG_G5_COMP);
		this.g5_Apparatus=new G5_Apparatus(this,this.flow,TAG_G5_APPARATUS);
		this.g5_Airpump=new G5_Airpump(this,this.flow,TAG_G5_AIRPUMP);
		this.g5_Bottle1=new G5_Bottle1(this,this.flow,TAG_G5_BOTTLE1);
		this.g5_Bottle2=new G5_Bottle2(this,this.flow,TAG_G5_BOTTLE2);
		
		var fontDef = new cc.FontDefinition();
		fontDef.fontName = "Arial";
		fontDef.fontSize = "20";
		fontDef.fillStyle=cc.color(0, 0, 0,255);
		
		this.desk=new Button(this,2,TAG_ITEM_DESK,"#equitment/desk.png");
		this.desk.setPosition(cc.p(gg.c_width*0.8, gg.c_height*0.5));
		// 电脑
		this.comp_close=new Button(this,3,TAG_ITEM_COMPCLOSE,"#equitment/computer_close.png",this.eventMenuCallback,this);
		this.comp_close.setPosition(cc.p(gg.c_width*0.28, gg.c_height*1.08));
		
		this.comp_open=new Button(this,3,TAG_ITEM_COMPOPEN,"#equitment/computer_open.png",this.eventMenuCallback,this);
		this.comp_open.setPosition(cc.p(gg.c_width*0.28, gg.c_height*1.08));
		this.comp_open.setVisible(false);
		
		this.comp_software=new Button(this,3,TAG_ITEM_COMPSOFTWARE,"#equitment/computer_software.png",this.eventMenuCallback,this);
		this.comp_software.setPosition(cc.p(gg.c_width*0.28, gg.c_height*1.08));
		this.comp_software.setVisible(false);
		
		this.comp_software1=new Button(this,3,TAG_ITEM_COMPSOFTWARE1,"#equitment/computer_software1.png",this.eventMenuCallback,this);
		this.comp_software1.setPosition(cc.p(gg.c_width*0.28, gg.c_height*1.08));
		this.comp_software1.setVisible(false);
		
		this.comp_software2=new Button(this,3,TAG_ITEM_COMPSOFTWARE2,"#equitment/computer_software2.png",this.eventMenuCallback,this);
		this.comp_software2.setPosition(cc.p(gg.c_width*0.28, gg.c_height*1.08));
		this.comp_software2.setVisible(false);
		
		this.comp_software3=new Button(this,3,TAG_ITEM_COMPSOFTWARE3,"#equitment/computer_software3.png",this.eventMenuCallback,this);
		this.comp_software3.setPosition(cc.p(gg.c_width*0.28, gg.c_height*1.08));
		this.comp_software3.setVisible(false);
		// 色谱仪
		this.apparatus=new Button(this,3,TAG_ITEM_APPARATUS,"#equitment/apparatus.png",this.eventMenuCallback,this);
		this.apparatus.setPosition(cc.p(gg.c_width*0.75, gg.c_height*1.08));
		// 上部打开
		this.apparatus1=new Button(this,3,TAG_ITEM_APPARATUS1,"#apparatus_top/apparatus_top7.png",this.eventMenuCallback,this);
		this.apparatus1.setPosition(cc.p(gg.c_width*0.745, gg.c_height*1.18));
		this.apparatus1.setVisible(false);
	
		this.apparatus2=new Button(this,3,TAG_ITEM_APPARATUS3,"#apparatus_top/apparatus_top8.png",this.eventMenuCallback,this);
		this.apparatus2.setPosition(cc.p(gg.c_width*0.75, gg.c_height*1.18));
		this.apparatus2.setVisible(false);
		
		this.apparatus_top=new Button(this,3,TAG_ITEM_APPARATUS8,"#apparatus_left/apparatus_top.png");
		this.apparatus_top.setPosition(cc.p(gg.c_width*0.75, gg.c_height*1.18));
		this.apparatus_top.setVisible(false);
		
		this.apparatus_center=new Button(this,4,TAG_ITEM_APPARATUS8,"#apparatus_left/apparatus_top_1.png");
		this.apparatus_center.setPosition(cc.p(gg.c_width*0.75, gg.c_height*1.18));
		this.apparatus_center.setVisible(false);
		// 左侧打开
		this.apparatus3=new Button(this,3,TAG_ITEM_APPARATUS9,"#apparatus_left/apparatus_left5.png",this.eventMenuCallback,this);
		this.apparatus3.setPosition(cc.p(cc.p(gg.c_width*0.75, gg.c_height*1.18)));
		this.apparatus3.setVisible(false);
		// 净化器
		this.treater=new Button(this,2,TAG_ITEM_TREATER,"#equitment/treater.png",this.eventMenuCallback,this);
		this.treater.setPosition(cc.p(gg.c_width*1.05, gg.c_height*1.05));
		// 空气泵
		this.airpump=new Button(this,2,TAG_ITEM_AIRPUMP,"#equitment/airpump.png",this.eventMenuCallback,this);
		this.airpump.setPosition(cc.p(gg.c_width*1.234, gg.c_height*1.03));
		// 气瓶柜
		this.cupboard=new Button(this,1,TAG_ITEM_CUPBOARD,"#cupboard/cupboard1.png",this.eventMenuCallback,this);
		this.cupboard.setPosition(cc.p(gg.c_width*1.78, gg.c_height*0.85));
		
		this.cupboard1=new Button(this,1,TAG_ITEM_CUPBOARD1,"#cupboard/cupboard6.png");
		this.cupboard1.setPosition(cc.p(gg.c_width*1.78, gg.c_height*0.85));
		this.cupboard1.setVisible(false);
		//试剂瓶
		this.ethylate=new Button(this,4,TAG_ITEM_ETHYLATE,"#equitment/ethylate_open.png");
		this.ethylate.setPosition(cc.p(gg.c_width*1.4, gg.c_height*1.02));
		// 盖子
		this.cap=new Button(this,5,TAG_ITEM_CAP,"#equitment/cap1.png",this.eventMenuCallback,this);
		this.cap.setPosition(cc.p(gg.c_width*1.4, gg.c_height*1.135));
		// 安捷伦进样瓶
		this.vessel=new Button(this,2,TAG_ITEM_VESSEL,"#equitment/vessel.png",this.eventMenuCallback,this);
		this.vessel.setPosition(cc.p(gg.c_width*1.35, gg.c_height*0.95));
		
		this.vessel1=new Button(this,2,TAG_ITEM_VESSEL,"#equitment/vessel1.png");
		this.vessel1.setPosition(cc.p(gg.c_width*1.35, gg.c_height*0.95));
		this.vessel1.setVisible(false);
		
		this.vessel_top=new Button(this,2,TAG_ITEM_VESSEL_TOP,"#equitment/vessel_top.png",this.eventMenuCallback,this);
		this.vessel_top.setPosition(cc.p(gg.c_width*1.44, gg.c_height*0.85));
		this.vessel_top.setVisible(false);
		// 注射器
		this.squirt=new Button(this,3,TAG_ITEM_SQUIRT,"#squirt/squirt7.png",this.eventMenuCallback,this);
		this.squirt.setPosition(cc.p(gg.c_width*1.15, gg.c_height*0.84));
		this.squirt.setAnchorPoint(cc.p(0.5,0.65));
		
		this.squirt1=new Button(this,3,TAG_ITEM_SQUIRT1,"#squirt/squirt1.png",this.eventMenuCallback,this);
		this.squirt1.setPosition(cc.p(gg.c_width*1.4, gg.c_height*1.3));
		this.squirt1.setAnchorPoint(cc.p(0.5,0.65));
		this.squirt1.setRotation(90);
		this.squirt1.setVisible(false);
		
		this.squirt2=new Button(this,3,TAG_ITEM_SQUIRT2,"#squirt/squirt7.png",this.eventMenuCallback,this);
		this.squirt2.setPosition(cc.p(gg.c_width*1.45, gg.c_height*1.45));
		this.squirt2.setAnchorPoint(cc.p(0.5,0.65));
		this.squirt2.setRotation(90);
		this.squirt2.setVisible(false);
		
		this.squirt3=new Button(this,3,TAG_ITEM_SQUIRT3,"#squirt/squirt1.png",this.eventMenuCallback,this);
		this.squirt3.setPosition(cc.p(gg.c_width*1.4, gg.c_height*1.3));
		this.squirt3.setAnchorPoint(cc.p(0.5,0.65));
		this.squirt3.setRotation(90);
		this.squirt3.setVisible(false);
		
		this.squirt_2=new Button(this,3,TAG_ITEM_SQUIRT,"#squirt/squirt_2.png");
		this.squirt_2.setPosition(cc.p(gg.c_width*1.45, gg.c_height*1.3));
		this.squirt_2.setOpacity(0);
		this.squirt_1=new Button(this,3,TAG_ITEM_SQUIRT,"#squirt/squirt_1.png");
		this.squirt_1.setPosition(cc.p(gg.c_width*1.45, gg.c_height*1.3))
		this.squirt_1.setOpacity(0);
		
		// 气瓶
		this.bottle1=new Button(this,2,TAG_ITEM_BOTTLE1,"#equitment/bottle1.png",this.eventMenuCallback,this);
		this.bottle1.setPosition(cc.p(gg.c_width*1.685, gg.c_height*0.832));
		this.bottle1.setVisible(false);

		this.bottle2=new Button(this,2,TAG_ITEM_BOTTLE2,"#equitment/bottle2.png",this.eventMenuCallback,this);
		this.bottle2.setPosition(cc.p(gg.c_width*1.83, gg.c_height*0.83));
		this.bottle2.setVisible(false);
		// 显示器
		if(teach_type == TAG_LEAD){
			this.display=new Button(this,4,TAG_ITEM_DISPLAY,"#equitment/display.png",this.eventMenuCallback,this);
			this.display.setPosition(cc.p(gg.c_width*0.946, gg.c_height*1.142));
			this.display.setVisible(false);
		}else{
			this.display=new Button(this,4,TAG_ITEM_DISPLAY,"#equitment/display1.png",this.eventMenuCallback,this);
			this.display.setPosition(cc.p(gg.c_width*0.946, gg.c_height*1.142));
			this.display.setVisible(false);
		}
		// 显示屏
		this.display_big=new Button(this,4,TAG_ITEM_DISPLAYBIG,"#equitment/display_big.png",this.eventMenuCallback,this);
		this.display_big.setPosition(cc.p(gg.c_width*0.928, gg.c_height*1.178));
		this.display_big.setOpacity(0);
		
		this.display_menu=new Button(this,3,TAG_ITEM_DISPLAYBIG,"#equitment/menu.png",this.eventMenuCallback,this);
		this.display_menu.setPosition(cc.p(gg.c_width*0.928, gg.c_height*1.178));
		this.display_menu.setOpacity(0);
		// 气路管线
		if(teach_type == TAG_LEAD){
		this.Pneumatic=new Button(this,1,TAG_ITEM_PNEUMATIC,"#equitment/Pneumatic.png",this.eventMenuCallback,this);
		this.Pneumatic.setPosition(cc.p(gg.c_width*1.423,gg.c_height*1.03));
		}else{
			this.Pneumatic=new Button(this,1,TAG_ITEM_PNEUMATIC,"#equitment/Pneumatic1.png",this.eventMenuCallback,this);
			this.Pneumatic.setPosition(cc.p(gg.c_width*1.423,gg.c_height*1.03));
		}
		this.Pneumatic_1=new Button(this,1,TAG_ITEM_PNEUMATIC1,"#equitment/Pneumatic1.png");
		this.Pneumatic_1.setPosition(cc.p(gg.c_width*1.423,gg.c_height*1.03));
		this.Pneumatic_1.setVisible(false);
		
		this.Pneumatic1=new Button(this,2,TAG_ITEM_PNEUMATIC,"#equitment/Pneumatic_1.png");
		this.Pneumatic1.setPosition(cc.p(gg.c_width*1.088,gg.c_height*0.92));
		
		this.Pneumatic2=new Button(this,2,TAG_ITEM_PNEUMATIC,"#equitment/Pneumatic_2.png");
		this.Pneumatic2.setPosition(cc.p(gg.c_width*1.028, gg.c_height*1.223));
		// 插座
		this.outlet=new Button(this,0,TAG_ITEM_OUTLET,"#equitment/outlet.png");
		this.outlet.setPosition(cc.p(gg.c_width*0.495, gg.c_height*1.18));
		// 电源线
		
		this.powerLine=new Button(this,0,TAG_ITEM_POWERLINE,"#equitment/powerLine.png",this.eventMenuCallback,this);
		this.powerLine.setPosition(cc.p(gg.c_width*0.385, gg.c_height));
		// 信号线
		this.signalLine=new Button(this,3,TAG_ITEM_SIGNALLINE1,"#equitment/signalline1.png");
		this.signalLine.setPosition(cc.p(gg.c_width*0.415, gg.c_height*0.95));
		if(teach_type == TAG_LEAD){
			this.signalLine1=new Button(this,3,TAG_ITEM_SIGNALLINE,"#equitment/signalline.png",this.eventMenuCallback,this);
			this.signalLine1.setPosition(cc.p(gg.c_width*0.415, gg.c_height*0.95));
			this.signalLine1.setVisible(false);
		}else{
			this.signalLine1=new Button(this,2,TAG_ITEM_SIGNALLINE,"#equitment/signalline1.png",this.eventMenuCallback,this);
			this.signalLine1.setPosition(cc.p(gg.c_width*0.415, gg.c_height*0.95));
			this.signalLine1.setVisible(false);
		}
		this.clock=new Button(this,6,TAG_ITEM_CLOCK,"#equitment/clock.png");
		this.clock.setPosition(cc.p(gg.c_width,gg.c_height));
		this.clock.setVisible(false);
		
		this.clock1=new Button(this,6,TAG_ITEM_CLOCK,"#equitment/clock1.png");
		this.clock1.setPosition(cc.p(gg.c_width,gg.c_height));
		this.clock1.setVisible(false);
		
		this.point=new Button(this,7,TAG_ITEM_POINT,"#equitment/point.png");
		this.point.setPosition(cc.p(gg.c_width, gg.c_height));
		this.point.setVisible(false);
		
		this.paperItem=new Button(this,4,TAG_ITEM_PAPERITEM,"#equitment/paper_item.png",this.eventMenuCallback,this);
		this.paperItem.setPosition(cc.p(gg.width*0.88,gg.height*0.945));
		var label1=new cc.LabelTTF("擦拭纸",fontDef);
		label1.setPosition(cc.p(gg.width*0.88,gg.height*0.88));
		this.addChild(label1);
		
		this.paper=new Button(this,3,TAG_ITEM_PAPER,"#equitment/paper.png");
		this.paper.setPosition(cc.p(gg.width*0.88,gg.height*0.945));
		this.paper.setVisible(false);
		
		this.initCupAction();
		this.initAppAction();
		this.initSquirtAction();
		
	},
	initCupAction:function(){
		var animFrames=[];
		for(var i=1;i<7;i++){
			var str="cupboard/cupboard"+i+".png";
			var frame=cc.spriteFrameCache.getSpriteFrame(str);
			animFrames.push(frame);
		}
		var animation=new cc.Animation(animFrames,0.1)
		animation.setRestoreOriginalFrame(true); 
		this.runningAction=cc.repeat(cc.animate(animation),1);
		this.runningAction.retain();
	},
	initAppAction:function(){
		var animFrames=[];
		for(var i=1;i<6;i++){
			var str="apparatus_left"+i+".png";
			var frame=cc.spriteFrameCache.getSpriteFrame(str);
			animFrames.push(frame);
		}
		var animation=new cc.Animation(animFrames,0.1)
		animation.setRestoreOriginalFrame(true); 
		this.runningAction1=cc.repeat(cc.animate(animation),1);
		this.runningAction1.retain();
	},
	initSquirtAction:function(){
		var animFrames=[];
		for(var i=7;i>0;i--){
			var str="squirt/squirt"+i+".png";
			var frame=cc.spriteFrameCache.getSpriteFrame(str);
			animFrames.push(frame);
		}
		var animation=new cc.Animation(animFrames,0.2);
		animation.setRestoreOriginalFrame(true); 
		this.runningAction2=cc.repeat(cc.animate(animation),1);
		this.runningAction2.retain();
	},
	showDesc:function(tag){
		if(cur_tool == TAG_BUTTON_HELP){
			for(var i = 0; i< sprite_json.length; i++){
				if(sprite_json[i].tag == tag){
					this.scene.tipLayer.sayFlash(sprite_json[i].desc);
					cc.log(sprite_json[i].desc);
					break;
				}
			}
		}
	},
	eventMenuCallback:function(pSender){
		this.showDesc(pSender.getTag());
		if(cur_tool != TAG_BUTTON_HAND){
			// 描述
			return;
		}
		if(!this.flow.checkTag(pSender.getTag())){
			// 是否可以触发
			_.error();
			this.scene.tipLayer.updateScore(gg.score);
			return;
		} else {
			if(this.status==true){
				_.clever();
				this.scene.tipLayer.updateScore(gg.score);
			}
				
		}
		var action = this.flow.flow.action;
		var func=cc.callFunc(this.checkActionDone,this);
		var func1=cc.callFunc(this.close,this);
		var func2=cc.callFunc(this.next,this);
		var rotate=cc.rotateBy(1,90);
		var rotate1=cc.rotateBy(1,-90);
		var rotate2=cc.rotateBy(1,180);
		var move=cc.moveTo(1,cc.p(gg.c_width*1.3, gg.c_height*1.45));
		var move1=cc.moveTo(1, cc.p(gg.c_width*1.4, gg.c_height*1.45));
		var move_right=cc.moveTo(0.5,cc.p(gg.c_width*1.45, gg.c_height*1.45));
		var move_left=cc.moveTo(0.5,cc.p(gg.c_width*1.4, gg.c_height*1.45));
		var move2=cc.moveTo(1, cc.p(gg.c_width*1.4, gg.c_height*1.3));
		var move4=cc.moveTo(1, cc.p(gg.c_width*0.7, gg.c_height*1.55));
		var move5=cc.moveTo(1, cc.p(gg.c_width*0.7, gg.c_height*1.45));
		var move7=cc.moveTo(1, cc.p(gg.c_width*1.3, gg.c_height*1.25));
		var move8=cc.moveTo(1, cc.p(gg.c_width*1.35, gg.c_height*1.25));
		var move9=cc.moveTo(1, cc.p(gg.c_width*1.35, gg.c_height*1.2));
		
		var move10=cc.moveTo(1,cc.p(gg.c_width*1.35,gg.c_height*1.45));
		var move11=cc.moveTo(1,cc.p(gg.c_width*1.45,gg.c_height*1.45));
		
		var move12=cc.moveTo(1,cc.p(gg.c_width*1.35,gg.c_height*1.45));
		var move13=cc.moveTo(1,cc.p(gg.c_width*1.35, gg.c_height*1.2));
		var moveTo=cc.moveTo(1,cc.p(gg.c_width*1.4, gg.c_height*1.32));
		var moveTo1=cc.moveTo(1,cc.p(gg.c_width*1.35, gg.c_height*1.2));
		var moveBack=cc.moveTo(1,cc.p(gg.width*0.88,gg.height*0.945));
		switch(pSender.getTag()){
		case TAG_ITEM_PNEUMATIC:
			this.flow.next();
			this.Pneumatic.setVisible(false);
			this.Pneumatic_1.setVisible(true);
			break;
		case TAG_ITEM_POWERLINE:
			this.flow.next();
			this.signalLine1.setVisible(true);
			this.signalLine.setVisible(false);
			break;
		case TAG_ITEM_SIGNALLINE:
			this.flow.next();
			this.signalLine1.setVisible(false);
			this.signalLine.setVisible(true);
			break;
		case TAG_ITEM_APPARATUS:
			this.flow.next();
			if(action==ACTION_DO1){
				this.g5_Apparatus.open();
			}else if(action==ACTION_DO3){
				this.g5_Apparatus.open();
				this.g5_Apparatus.apparatus1.setVisible(false);
				this.g5_Apparatus.apparatus2.setVisible(true);
			}
			break;
		case TAG_ITEM_COMPCLOSE:
			this.flow.next();
			this.g5_Comp.open();
			break;
		case TAG_ITEM_CUPBOARD:
			if(this.status==true){
				this.cupboard.runAction(cc.sequence(this.runningAction,func,func2));
			}
			this.status=false;
			break;
		case TAG_ITEM_BOTTLE1:
			this.flow.next();
			this.g5_Bottle1.open();
			if(action==ACTION_DO1){
				this.g5_Bottle1.bottle_top.setVisible(true);
			}
			break;
		case TAG_ITEM_BOTTLE2:
			this.flow.next();
			this.g5_Bottle2.open();
			if(action==ACTION_DO1){
				this.g5_Bottle2.bottle_top.setVisible(true);
			}
			break;
		case TAG_ITEM_AIRPUMP:
			this.flow.next();
			this.g5_Airpump.open();
			if(action==ACTION_DO1){
				this.g5_Airpump.airpump_close.setVisible(true);
			}
			break;
		case TAG_ITEM_APPARATUS1:
			this.flow.next();
			this.g5_Apparatus.open();
			this.g5_Apparatus.apparatus2.setVisible(false);
			this.g5_Apparatus.apparatus_right.setVisible(true);
			this.g5_Apparatus.apparatus_open.setVisible(true);
			break;
		case TAG_ITEM_DISPLAY:
			var fadein=cc.fadeIn(2);
			var rotate=cc.rotateBy(2,360);
			var scale=cc.scaleTo(1,1.5);
			var fadeout=cc.fadeOut(1);
			var scale1=cc.scaleTo(1,1);
			if(this.status==true){
				if(action==ACTION_DO1){
					this.display.setVisible(false);
					this.display_menu.runAction(cc.sequence(cc.spawn(fadein,scale),cc.delayTime(2),cc.spawn(fadeout,scale1),func,func2));
				}else if(action==ACTION_DO2){
					this.display.setVisible(false);
					this.display_big.runAction(cc.sequence(cc.spawn(fadein,scale),cc.delayTime(2),cc.spawn(fadeout,scale1),func,func2));
				}
			}
			this.status=false;
			break;
		case TAG_ITEM_COMPOPEN:
			this.flow.next();
			this.g5_Comp.open();
			break;
		case TAG_ITEM_APPARATUS3:
			this.flow.next();
			if(action==ACTION_DO1){
				this.g5_Apparatus.open();
				this.g5_Apparatus.apparatus_right.setVisible(false);
				this.g5_Apparatus.apparatus3.setVisible(true);
			}
			break;
		case TAG_ITEM_CAP:
			var ber=cc.bezierBy(1, [cc.p(10,35),cc.p(25, 65),cc.p(25,-80)]);
			var rotate=cc.rotateBy(1,180);
			if(action==ACTION_DO1){
				pSender.runAction(cc.sequence(cc.spawn(ber,rotate),cc.callFunc(function() {
					this.flow.next();
				},this)));
			}else if(action==ACTION_DO2){
				pSender.runAction(cc.sequence(cc.spawn(ber.reverse(),rotate.reverse()),cc.callFunc(function() {
					this.flow.next();
				},this)));
			}
			
			break;
		case TAG_ITEM_SQUIRT:
			if(this.status==true){
				if(action==ACTION_DO1){
					this.squirt.runAction(cc.sequence(rotate,move,move1,move2,this.runningAction2,func,func2));
				}else if(action==ACTION_DO2){
					this.squirt.runAction(cc.sequence(rotate,move,move1,move2,this.runningAction2,func,func2));
				}else if(action==ACTION_DO3){
					this.squirt.runAction(cc.sequence(rotate,move7,move8,move9,this.runningAction2,func,func2));
				}else if(action==ACTION_DO4){
					this.squirt.runAction(cc.sequence(move12,move13,this.runningAction2,func,func2));
				}else if(action==ACTION_DO5){
					this.squirt.runAction(cc.sequence(move12,move13,this.runningAction2,func,func2));
				}else if(action==ACTION_DO6){
					this.squirt.runAction(cc.sequence(rotate,move7,move8,move9,this.runningAction2,func,func2));
				}
			}
			this.status=false;
			break;
		case TAG_ITEM_SQUIRT1:
			if(this.status==true){
				if(action==ACTION_DO1){
					this.squirt1.runAction(cc.sequence(move1,move_right,rotate2,this.runningAction2.reverse(),func,rotate2.reverse(),func2));
				}else if(action==ACTION_DO2){
					this.squirt1.runAction(cc.sequence(move4,move5,this.runningAction2.reverse(),func));
				}else if(action==ACTION_DO3){
					this.squirt1.runAction(cc.sequence(move10,move11,rotate2,this.runningAction2.reverse(),func,rotate2.reverse(),func2));
				}else if(action==ACTION_DO4){
					this.squirt1.runAction(cc.sequence(func,func2));
				}
			}
			this.status=false;
			break;
		case TAG_ITEM_SQUIRT2:
			if(this.status==true){
			if(action==ACTION_DO1){
				this.squirt2.runAction(cc.sequence(move_left,move2,this.runningAction2,func,func2));
			}else if(action==ACTION_DO2){
				this.squirt2.runAction(cc.sequence(rotate,move5,this.runningAction2,func,func2));
			}
			}
			this.status=false;
			break;
		case TAG_ITEM_SQUIRT3:
			if(this.status==true){
			if(action==ACTION_DO1){
				this.squirt3.runAction(cc.sequence(move4,move5,this.runningAction2.reverse(),func));
			}
			}
			this.status=false;
			break;
		case TAG_ITEM_VESSEL:
			this.flow.next();
			this.vessel.setVisible(false);
			this.vessel1.setVisible(true);
			this.vessel_top.setVisible(true);
			break;
		case TAG_ITEM_PAPERITEM:
			if(this.status==true){
					this.paper.setVisible(true);
					if(action==ACTION_DO1){
						this.paper.runAction(cc.sequence(moveTo,cc.delayTime(2),moveBack,cc.callFunc(function a(){
						this.paper.setVisible(false);
						this.apparatus_top.setVisible(true);
						this.apparatus_center.setVisible(true);
						this.apparatus3.setVisible(false);
						},this),func,func2));
					}else if(action==ACTION_DO2){
						this.paper.runAction(cc.sequence(moveTo1,cc.delayTime(2),moveBack,cc.callFunc(function a(){
							this.paper.setVisible(false);
							this.apparatus_top.setVisible(true);
							this.apparatus_center.setVisible(true);
							this.apparatus3.setVisible(false);
						},this),func,func2));
					}
			}
			this.status=false
			break;
		case TAG_ITEM_COMPSOFTWARE:
			this.flow.next();
			this.g5_Comp.open();
			if(action==ACTION_DO1){
				this.g5_Comp.detection.setVisible(true);
			}
			break;
		case TAG_ITEM_COMPSOFTWARE1:
			this.flow.next();
			this.g5_Comp.open();
			if(action==ACTION_DO1){
				this.g5_Comp.addPlan.setVisible(true);
			}
			break;
		case TAG_ITEM_COMPSOFTWARE2:
			this.flow.next();
			this.g5_Comp.open();
			if(action==ACTION_DO1){
				this.g5_Comp.sampling.setVisible(true);
			}else if(action==ACTION_DO2){
				this.g5_Comp.sampling.setVisible(true);
			}else if(action==ACTION_DO3){
				this.g5_Comp.sampling.setVisible(true);
			}
			break;
		case TAG_ITEM_COMPSOFTWARE3:
			this.flow.next();
			if(action==ACTION_DO1){
				this.g5_Comp.open();
				this.g5_Comp.open_comp.setVisible(true);
			}else if(action==ACTION_DO2){
				this.g5_Comp.open();
				this.g5_Comp.bg.setSpriteFrame("window/lite.png");
				this.g5_Comp.comp_open.setVisible(true);
				this.g5_Comp.close_comp.setVisible(true);
			}else{
				this.g5_Comp.open();
				this.g5_Comp.sampling.setVisible(true);
			}
			break;
		case TAG_ITEM_CAP:
			this.flow.next();
			this.cap.setVisible(false);
			this.ethylate1.setVisible(false);
			this.ethylate.setVisible(true);
			break;
		case TAG_ITEM_APPARATUS9:
			if(action==ACTION_DO1){
				this.flow.next();
				this.g5_Apparatus.open();
				this.g5_Apparatus.apparatus3.setVisible(false);
				this.g5_Apparatus.apparatus4.setVisible(false);
				this.g5_Apparatus.apparatus_right.setVisible(true);
				this.g5_Apparatus.apparatus_close.setVisible(true);
			}
		default:
			break;
		}
	},
	checkActionDone:function(pSender){
		var tag=pSender.getTag();
		var action = this.flow.flow.action;
		var func2=cc.callFunc(this.next,this);
		var rotate1=cc.rotateBy(1,-90);
		var move3=cc.moveTo(1, cc.p(gg.c_width*1.4, gg.c_height*1.55));
		var move6=cc.moveTo(1, cc.p(gg.c_width*1.15, gg.c_height*0.84));
		var move10=cc.moveTo(1, cc.p(gg.c_width*1.35, gg.c_height*1.45));
		if(tag==TAG_ITEM_CUPBOARD){
			this.bottle1.setVisible(true);
			this.bottle2.setVisible(true);
			this.cupboard.setVisible(false);
			this.cupboard1.setVisible(true);
		}else if(tag==TAG_ITEM_DISPLAY){
			if(action==ACTION_DO1){
				this.display.setVisible(false);
			}else if(action==ACTION_DO2){
				this.display.setVisible(false);
			}
		}else if(tag==TAG_ITEM_SQUIRT){
			if(action==ACTION_DO1){
				this.squirt.setVisible(false);
				this.squirt1.setVisible(true);
			}else if(action==ACTION_DO2){
				this.squirt.setVisible(false);
				this.squirt1.setVisible(true);
				this.squirt1.setRotation(90);
				this.squirt1.setPosition(cc.p(gg.c_width*1.4, gg.c_height*1.3));
				this.squirt1.runAction(move3);
			}else if(action==ACTION_DO3){
				this.squirt1.setVisible(true);
				this.squirt.setVisible(false);
				this.squirt1.setPosition(cc.p(gg.c_width*1.35, gg.c_height*1.2));
			}else if(action==ACTION_DO4){
				this.squirt1.setVisible(true);
				this.squirt.setVisible(false);
				this.squirt1.setPosition(cc.p(gg.c_width*1.35, gg.c_height*1.2));
				this.squirt1.setRotation(90);
			}else if(action==ACTION_DO5){
				this.squirt1.setVisible(true);
				this.squirt.setVisible(false);
				this.squirt1.setPosition(cc.p(gg.c_width*1.35, gg.c_height*1.2));
				this.squirt1.setRotation(90);
				this.squirt1.runAction(move10);
			}else if(action==ACTION_DO6){
				this.squirt1.setVisible(true);
				this.squirt.setVisible(false);
				this.squirt1.setPosition(cc.p(gg.c_width*1.35, gg.c_height*1.2));
				this.squirt1.runAction(move10);
			}
		}else if(tag==TAG_ITEM_SQUIRT1){
			if(action==ACTION_DO1){
				this.squirt1.setVisible(false);
				this.squirt2.setVisible(true);
			}else if(action==ACTION_DO2){
				this.squirt1.setVisible(false);
				this.squirt.setVisible(true);
				this.squirt.setPosition(cc.p(gg.c_width*0.7, gg.c_height*1.45));
				this.apparatus3.setVisible(true);
				this.apparatus_top.setVisible(false);
				this.apparatus_center.setVisible(false);
				this.squirt.runAction(cc.sequence(move6,rotate1,func2));
			}else if(action==ACTION_DO3){
				this.squirt1.setVisible(false);
				this.squirt.setVisible(true);
				this.squirt.setPosition(cc.p(gg.c_width*1.45, gg.c_height*1.45));
				this.squirt.setRotation(90);
			}else if(action==ACTION_DO4){
				this.squirt_1.runAction(cc.sequence(cc.fadeIn(1),cc.delayTime(2),cc.fadeOut(1)));
				this.squirt_2.runAction(cc.sequence(cc.fadeIn(1),cc.delayTime(2),cc.fadeOut(1)));
			}
		}else if(tag==TAG_ITEM_SQUIRT2){
			if(action==ACTION_DO1){
				this.squirt2.setVisible(false);
				this.squirt3.setVisible(true);
				this.squirt3.runAction(move3);
			}else if(action==ACTION_DO2){
				this.squirt2.setVisible(false);
				this.squirt3.setVisible(true);
				this.squirt3.setPosition(cc.p(gg.c_width*1.4, gg.c_height*1.45));
				this.squirt3.runAction(move3);
			}
		}else if(tag==TAG_ITEM_SQUIRT3){
			if(action==ACTION_DO1){
				this.squirt3.setVisible(false);
				this.squirt.setVisible(true);
				this.squirt.setPosition(cc.p(gg.c_width*0.7, gg.c_height*1.45));
				this.apparatus3.setVisible(true);
				this.apparatus_top.setVisible(false);
				this.apparatus_center.setVisible(false);
				this.squirt.runAction(cc.sequence(move6,rotate1,func2));
			}
		}else if(tag==TAG_ITEM_PAPERITEM){
			this.paper.setVisible(false);
		}
		this.status=true;
	},
	next:function(){
		this.flow.next();
	}
	
});
